package csd.wyaiyr.com.controller;


import csd.wyaiyr.com.config.BaseResult;
import csd.wyaiyr.com.model.SysUser;
import csd.wyaiyr.com.service.SysUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "登录模块")
@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private SysUserService sysUserService;

    @Operation(summary = "获取注册验证码")
    @PostMapping("/getRegisterCheckCode")
    public BaseResult getRegisterCheckCode(@RequestBody SysUser sysUser){
        return sysUserService.getRegisterCheckCode(sysUser);
    }

    @Operation(summary = "用户注册")
    @PostMapping("/register")
    public BaseResult register(@RequestBody SysUser sysUser){
        return sysUserService.register(sysUser);
    }

    @Operation(summary = "登录")
    @PostMapping("/login")
    public BaseResult login(@RequestBody SysUser sysUser){
        return sysUserService.login(sysUser);
    }



}
